package com.digitalchina.lxnsy.api;

import android.app.Activity;
import android.os.Handler;

import com.digitalchina.lxnsy.constant.MSG;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.OkHttpUtil;
import com.digitalchina.lxnsy.xml.UserXML;
import com.lzy.okhttputils.model.HttpParams;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：打赏API
 * 包名：com.digitalchina.bigdata.api
 * 创建人：郑皓
 * 创建时间：2018/5/17 15:03
 * 修改备注：
 * ================================================
 */
public class BusinessReward {

    /**
     * 打赏统计
     *
     * @param activity
     * @param agriConsultId 专家ID
     * @param handler
     */
    public static void queryRewardInfo(Activity activity, String agriConsultId, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("agriConsultId", agriConsultId);

        OkHttpUtil.post(activity, URL.URL_QUERY_REWARD_INFO, "", params, handler, MSG.MSG_QUERY_REWARD_INFO_SUCCESS, MSG.MSG_QUERY_REWARD_INFO_FIELD);

    }

    /**
     * 打赏
     *
     * @param activity
     * @param money         打赏金额
     * @param agriConsultId 被打赏id
     * @param redType       0 - 咨询打赏  1- 直播打赏
     * @param handler
     */
    public static void reward(Activity activity, String money, String agriConsultId, String redType, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("rewardUserAccId", UserXML.getUserId(activity));
        params.put("money", money);
        params.put("agriConsultId", agriConsultId);
        params.put("redType", redType);

        OkHttpUtil.post(activity, URL.URL_REWARD, "", params, handler, MSG.MSG_REWARD_SUCCESS, MSG.MSG_REWARD_FIELD);

    }


    /**
     * 打赏列表(历史)
     *
     * @param activity
     * @param agriConsultId
     * @param page
     * @param limit
     * @param handler
     */
    public static void rewardList(Activity activity, String agriConsultId, int page, int limit, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("agriConsultId", agriConsultId);
        params.put("page", String.valueOf(page));
        params.put("limit", String.valueOf(limit));

        OkHttpUtil.post(activity, URL.URL_REWARD_LIST, "", params, handler, MSG.MSG_REWARD_LIST_SUCCESS, MSG.MSG_REWARD_LIST_FIELD);

    }
}
